//
//  LKProgressView.swift
//  新浪微博
//
//  Created by 胡不归是大虾 on 16/9/25.
//  Copyright © 2016年 胡不归是大虾. All rights reserved.
//

import UIKit

class LKProgressView: UIView {
    init () {
        super.init(frame: CGRect(x: 0, y: 0, width: 0, height: 3))
        self.backgroundColor = UIColor.blue
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    func showLoadingView (){
//        self.frame.size.width = 0
//        self.alpha = 1
        UIView.animate(withDuration: 0.3, animations: {
            self.frame.size.width = 0.6 * UIScreen.main.bounds.width
            }) { (_) in
                UIView.animate(withDuration: 0.2, animations: {
                    self.frame.size.width = 0.8 * UIScreen.main.bounds.width
                })
        }
    }
    func showFinishView() {
//        UIView.animate(withDuration: 0.3) {
//            self.frame.size.width = UIScreen.main.bounds.width
//        }
        UIView.animate(withDuration: 0.3, animations: {
            self.frame.size.width = UIScreen.main.bounds.width
            }) { (_) in
                self.alpha = 0
        }
    }
}
